//
// Created by 崔世强 on 2018/4/13.
// Copyright (c) 2018 Facebook. All rights reserved.
//

import Foundation
import SnapKit

class SelectViewCell: UITableViewCell {
    
    //头像
    lazy var avatar: UIButton = {
        let avaBtn = UIButton()
        avaBtn.setImage(#imageLiteral(resourceName: "defaultAvatar"), for: .normal)
        return avaBtn
    }()
    
    lazy var nameLabel:UILabel = {
        let nameL = UILabel()
        //        nameL.textColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
        nameL.font = UIFont.systemFont(ofSize: 14.0)
        nameL.lineBreakMode = .byTruncatingMiddle
        //        nameL.layer.borderWidth = 1
        return nameL
    }()
    
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        //添加子view
        self.contentView.addSubview(avatar)
        self.contentView.addSubview(nameLabel)
        avatar.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(15)
            make.top.equalToSuperview().offset(5)
            make.bottom.equalToSuperview().offset(-5)
            make.width.height.equalTo(40)
        }
        
        nameLabel.snp.makeConstraints { make in
            make.left.equalTo(self.avatar.snp.right).offset(15)
            make.height.equalTo(30)
            make.centerY.equalTo(self.avatar)
            make.right.equalToSuperview().offset(-5)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
